home *** CD-ROM | disk | FTP | other *** search
/ PC Users 1999 April / Cd Pc Users extra 19 abril 1999.iso / Prog / Inst / Js02 / js02.exe / jscripts / mvrightv01.js < prev    next >
Encoding:
JavaScript  |  1998-11-12  |  1.5 KB  |  44 lines

  1. //----------------------------------------------------------------------
  2. // JavaScript Code for Navigator 4+ and Internet Explorer 4+
  3. //-------------------------------------------------------------------
  4. // Moving Object Right
  5. // signe_browser=0: Netscape Navigator 4 & signe_browser=1: Internet Explorer 4
  6. // ly:         object which is moving
  7. // signe_up=0     Initialization
  8. // newposRight:     New Position of Object ; newposRight=0 (initial value for Navigator)
  9. // limitStep:     pixel size for step  
  10. // stepRight:      pixel size initial for step
  11. // limitRight:     limit distance for moving 
  12. // dtime:         timeout for moving object in ms
  13. //---------------------------------------------------------------------
  14.  
  15.  
  16. function movingRight(signe_browser,ly,signe_up,newposRight,stepRight,limitStep,limitRight,dtime){
  17.     if (signe_up==0) {
  18.         if (signe_browser==0) newposRight=document[ly].left;
  19.         signe_up=1;
  20.             stepRight=newposRight/2;
  21.     }
  22.       if (newposRight < limitRight ) {
  23.           newposRight=newposRight+stepRight;
  24.         if (stepRight > limitStep) stepRight=stepRight/2;
  25.         if (signe_browser==0) document[ly].left=newposRight;
  26.         if (signe_browser==1) document.all[ly].style.left=newposRight;
  27.  
  28.           var timeout_id_movingRight=setTimeout("movingRight("+signe_browser+",'"+ly+"',"+signe_up+","+newposRight+","+stepRight+","+limitStep+","+limitRight+","+dtime+")", dtime);
  29.           return;
  30.     }
  31.       if (newposRight >= limitRight ) {
  32.         clearTimeout(timeout_id_movingRight);
  33.         timeout_id_movingRight=null;
  34.         end_movingRight();
  35.     }
  36. }
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.